package com.zgjkhis.modules.system.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @Author yzq
 * @Description 药品入库清单
 * @Date 2021/6/23 9:38
 * @Param
 * @return
 **/
@Data
@TableName("his_drug_warehousing_detail")
public class DrugWareHousingDetail implements Serializable {

    @TableId
    @ApiModelProperty(value = "主键id(修改时必填)")
    private Long id;
    @ApiModelProperty(value = "药品id",required = true)
    @NotNull(message = "药品id不能为空")
    private Long drugId;
    @ApiModelProperty(value = "药品名称")
    private String drugName;
    @ApiModelProperty(value = "预定数量",required = true)
    @NotNull(message = "预定数量不能为空")
    private Integer scheduledQuantity;
    @ApiModelProperty(value = "当前库存")
    private Integer stock;
    @ApiModelProperty(value = "剂量单位当前库存")
    private Integer minStock;
    @ApiModelProperty(value = "当前零售价")
    private BigDecimal salePrice;
    @ApiModelProperty(value = "折扣价",required = true)
    @NotNull(message = "折扣价不能为空")
    private BigDecimal costPrice;
    @ApiModelProperty(value = "成本价",required = true)
    @NotNull(message = "成本价不能为空")
    private BigDecimal selfPrice;
    @ApiModelProperty(value = "红冲",required = true)
    @NotNull(message = "红冲不能为空")
    private BigDecimal redPun;
    @ApiModelProperty(value = "有效期",required = true)
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")
    private Date termOfValidity;
    @ApiModelProperty(value = "批次号")
    private String batchNo;
    @ApiModelProperty(value = "入库订单号")
    private String wareHousingNo;
    @ApiModelProperty(value = "规格")
    private String drugSpec;
    @ApiModelProperty(value = "生产厂家")
    private String drugManufactor;
    @ApiModelProperty(value = "包装单位")
    private String packageUnit;
    @ApiModelProperty(value = "剂量单位")
    private String doseUnit;
    @ApiModelProperty(value = "药房id")
    private String pharmacyId;
    @ApiModelProperty(value = "剩余数量")
    private Integer leftCount;
    @ApiModelProperty(value = "计量单位剩余数量")
    private Integer minLeftCount;
    @ApiModelProperty(value = "当量")
    private Double equivalent;
    @ApiModelProperty(value = "采购单位")
    private String coefficientName;
    @ApiModelProperty(value = "换算系数")
    private Double coefficient;
    @ApiModelProperty(value = "商品总价")
    private BigDecimal commodityPrice;
    @ApiModelProperty(value = "成本总价")
    private BigDecimal commoditySelfPrice;
    @ApiModelProperty(value = "实际入库数量")
    private Integer actualQuantity;
    @ApiModelProperty(value = "入库单位")
    private String warehousingUnit;

    /** 创建时间 */
    @TableField(fill= FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date createTime;


    public void copy(DrugWareHousingDetail source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
